#pragma once

#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment (lib,"dinput8.lib")
#pragma comment (lib,"dxguid.lib")

#include <string>
#include <vector>
using namespace std;

#include "clkVec2.h"
#include "clkVec3.h"

class clkDirectInput
{
protected:
	HWND m_diHwnd;
	LPDIRECTINPUT8 m_diObject;
	LPDIRECTINPUTDEVICE8 m_diKeyboard;
	LPDIRECTINPUTDEVICE8 m_diMouse;

	BYTE m_diKeyboardState[256];
	DIMOUSESTATE m_diMouseState;

	int m_diPrevKey;
	int m_diPrevButton;
	vector<int> m_diPrevKeys;
	vector<int> m_diPrevButtons;
public:
	//ctor & dtor
	clkDirectInput();
	~clkDirectInput();

	//init functions
	void initDirectInput(
		HWND a_hwnd,
		HINSTANCE a_hInstance);
	void shutDirectInput();

	//update functions
	void acquire();

	//input functions
	bool keyInput(int a_key);
	bool keyPress(int a_key, bool a_ignore = false);
	bool mouseInput(int a_button);
	bool mousePress(int a_button);
	V3DF mouseDelta();
	V2DF mousePosition();
};